package main

import "fmt"

type Animal interface {
	say()
	getType() string
}

type cat struct {
	cate string
}

func (c *cat) say() {
	fmt.Println("mao mao mao")
}

func (c *cat) getType() string {
	return c.cate
}

type dog struct {
	cate string
}

func (d *dog) say() {
	fmt.Println("wan wan wan")
}

func (d *dog) getType() string {
	return d.cate
}

func printAnimalType(animal Animal) {
	fmt.Println(animal.getType())
}

func main() {
	c := cat{"Cat"}
	c.say()
	printAnimalType(&c)

	d := dog{"Dog"}
	d.say()
	printAnimalType(&d)
}
